#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
int a[5];
int id[32], s[32];
string name[32];
bool cmp(int i, int j) {
  if (s[i] != s[j])
    return s[i] > s[j];
  else
    return name[i] < name[j];
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  rep(i, 0, 4) cin >> a[i];
  rep(i, 1, 31) id[i] = i;
  rep(i, 1, 31) {
    rep(j, 0, 4) {
      if (i & (1 << j)) {
        name[i] += char('A' + j);
        s[i] += a[j];
      }
    }
  }
  sort(id + 1, id + 32, cmp);
  rep(i, 1, 31) cout << name[id[i]] << endl;
  return 0;
}